/*
Copyright (C) 1996-1997 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
// vid.h -- video driver defs

#pragma once

#define VID_CBITS	6
#define VID_GRADES	(1 << VID_CBITS)

typedef struct viddef_s
{
	HWND		Window;
	byte		*palette;
	byte		*colormap;		// 256 * VID_GRADES size
	int			Width;
	int			Height;
	int			SbarLines;

	// size of the viewport for 3D drawing
	int			ViewWidth;
	int			ViewHeight;

	BOOL		Occluded;
	BOOL		HandleResize;
	int			RecalcRefdef;	// if TRUE, recalc vid-based stuff
	BOOL		Initialized;
	BOOL		ActiveApp;
	BOOL		Minimized;
	BOOL		SkipThisFrame;
	BOOL		QueueModeChange;
	int			LastWindowedMode;
	int			LastFullscreenMode;
	DXGI_MODE_DESC *ModeList;
	int			NumModes;
} viddef_t;

extern	viddef_t	vid;				// global video state

extern	unsigned	d_8to24table_rgba[256];
extern	unsigned	d_8to24table_luma[256];

// called at startup and after any gamma correction
void VID_SetPalette (unsigned char *palette);

// Called at startup to set up translation tables, takes 256 8 bit RGB values
// the palette data will go away after the call, so it must be copied off if
// the video driver will need it again
void VID_Init (void);

// Called at shutdown
void VID_Shutdown (void);

// sets the mode; only used by the Quake engine for resetting to mode 0 (the
// base mode) on memory allocation failures
int VID_SetMode (int modenum);

void VID_InitCmds (void);
void VID_InitMenu (void);

void VID_EnumerateModes (void);
void D3D_CreateDevice (HWND hWnd, DXGI_MODE_DESC *mode, BOOL windowed);
void VID_ShutdownD3D (void);
void VID_UpdateVideoMenu (void);

#define VID_MINIMUM_W	400
#define VID_MINIMUM_H	300

